home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
SECURITY
/
0058.ZIP
/
PC-CODE2.151
< prev
next >
Wrap
Text File
|
1984-02-09
|
20KB
|
726 lines
1000 '
1010 '
1020 ' <<<<< P C - C O D E 2 . 1 5 1 >>>>>
1030 '
1040 '
1050 ' * * * * * * * * * * * * * * * * * * * *
1060 ' * *
1070 ' * COPYRIGHT 1984 by *
1080 ' * Richard Nolen Colvard *
1090 ' * Freeware Distribution OK *
1100 ' * Public Domain use OK *
1110 ' * *
1120 ' * WARNING: This Program must be *
1130 ' * Compiled with IBM *
1140 ' * BASCOM/T/O *
1150 ' * Donot use BASICA *
1160 ' * *
1170 ' * Highly recommend 8087 link libs *
1180 ' * *
1190 ' * * * * * * * * * * * * * * * * * * * *
1200 '
1210 '
1220 DIM B#(31), C#(99), CONS!(7), CONS#(6), IX%(256)
1230 DIM BCNT%(31), CCNT%(99), CHNO%(256), SAV%(256)
1240 CONS!(1)=8: CONS!(2)=131072! : CONS!(3)=8192: CONS!(4)=128
1250 CONS!(5)=2: CONS!(6)=32 : CONS!(7)=2048 : L0% = 95 : K0% = L0% * 2
1260 CONS#(1)=1: CONS#(2)=128 : CONS#(3)=32768# : CONS!(4)=8388608#
1270 CONS#(5)=4096 : CONS#(6)=1048576# : ACNT! = 0
1280 M%=7: N%=17: YY# = 999991! : MU# = 16807 : MD# = 2147483647#
1290 SAME1! = 0 : SAME2! = 0 : TOT! = 0
1300 W1$="123456789012345678901234567890123456789012345678901234567890"
1310 W2$=" 1 2 3 4 5 6"
1320 W3$=".........+.........+.........+.........+.........+.........+"
1330 W4$=" 7 8 9 10 11 12"
1340 WH$="V1.51 PC-CODE2"
1350 WZ$="P C C o m p u t e r S e c u r i t y " + WH$
1360 HDR$=WH$ + " ENCODED " + DATE$ + " " + TIME$
1370 FOR J%=1 TO M% : BCNT%(J%)=0 : NEXT J%
1380 FOR J%=1 TO N% : CCNT%(J%)=0 : NEXT J%
1390 FOR J%=1 TO 256 : CHNO%(J%)=0 : SAV%(J%)=J% : NEXT J%
1400 GOSUB 6590
1410 PRINT " " : PRINT " "
1420 PRINT "Debug Statistics will slow down program execution"
1430 INPUT "Do You Wish Debuging Statistics (Y OR N) ";A$
1440 A$=LEFT$(A$,1)
1450 IF A$ = "Y" OR A$ = "y" THEN DEBUG$="Y" ELSE DEBUG$="N"
1460 PRINT " " : PRINT " "
1470 INPUT "Do You Wish to Load KEYS from a FILE (Y or N) ";A$
1480 A$=LEFT$(A$,1)
1490 IF A$ = "Y" OR A$ = "y" THEN GOSUB 6810 : GOTO 2550
1500 CLS
1510 FOR J%=10 TO 15
1520 IF CL$="Y" THEN COLOR J%,9,1
1530 PRINT "P C - C O D E 2 ......Textual SuperEncipherment......"
1540 NEXT J%
1550 IF CL$="Y" THEN COLOR 15,9,1
1560 PRINT " "
1570 PRINT " "
1580 PRINT " ": PRINT " "
1590 PRINT " ": PRINT " "
1600 PRINT " Enter the type of KEY desired"
1610 PRINT " Numeric; Number Only key ";
1620 IF CL$="Y" THEN COLOR 13,0,0: PRINT "N" : COLOR 15,9,1
1630 IF CL$="N" THEN PRINT "N"
1640 PRINT " Alphabetic; alphanumeric ";
1650 IF CL$="Y" THEN COLOR 13,0,0: PRINT "A" : COLOR 15,9,1
1660 IF CL$="N" THEN PRINT "A"
1670 INPUT " Enter N or A "; T$
1680 T$=LEFT$(T$,1)
1690 IF T$="a" THEN T$="A"
1700 IF T$="n" THEN T$="N"
1710 IF T$ <> "A" AND T$ <> "N" THEN 1670
1720 IF T$="N" THEN 1770
1730 IF T$="A" THEN 3880
1740 '
1750 '
1760 '
1770 CLS
1780 PRINT WZ$
1790 PRINT " "
1800 PRINT " "
1810 PRINT " There are two(2) levels of Security HIGH and LOW"
1820 INPUT " Enter H for HIGH or L for LOW "; A$
1830 A$=LEFT$(A$,1)
1840 IF A$ <> "H" AND A$ <> "h" AND A$ <> "L" AND A$ <> "l" THEN 1800
1850 IF A$ = "H" OR A$ = "h" THEN 1980
1860 '
1870 ' ----------- LOW level of SECURITY -------------
1880 '
1890 PRINT " LOW Level of Security Selected"
1900 PRINT " "
1910 PRINT " You must now enter SEVEN (7) KEY numbers as indicated:"
1920 PRINT " "
1930 GOSUB 4090
1940 GOTO 2550
1950 '
1960 '
1970 '
1980 PRINT " "
1990 PRINT " You have Selected HIGH security"
2000 PRINT " "
2010 PRINT " You must enter ";1+N%+M%;" key numbers between 1 and 2,147,483,646"
2020 INPUT " A(1) ? "; A#
2030 A#=FIX(A#)
2040 IF A# < 1 OR A# >= MD# THEN GOSUB 2400: GOTO 2020
2050 PRINT " "
2060 '
2070 '
2080 FOR J%=1 TO M%
2090 PRINT " B(";J%;") ";
2100 INPUT B#(J%)
2110 B#(J%)=FIX(B#(J%))
2120 IF B#(J%) < 1 OR B#(J%) >= MD# THEN GOSUB 2400: GOTO 2090
2130 NEXT J%
2140 CLS
2150 '
2160 '
2170 FOR J%=1 TO N%
2180 PRINT " C(";J%;") ";
2190 INPUT C#(J%)
2200 C#(J%)=FIX(C#(J%))
2210 IF C#(J%) < 1 OR C#(J%) >= MD# THEN GOSUB 2400: GOTO 2180
2220 IF J% = 18 THEN CLS
2230 IF J% = 36 THEN CLS
2240 NEXT J%
2250 '
2260 GOTO 2550
2270 '
2280 '
2290 '
2300 PRINT "[";X%;"] ";
2310 INPUT "Enter a NUMBER between 1 and 9,999,999 "; K2!
2320 IF K2! < 1 OR K2! > 9999999! THEN GOSUB 2400: GOTO 2300
2330 Z!=K2!
2340 GOSUB 2490
2350 S!=Z!
2360 RETURN
2370 '
2380 '
2390 ' ---------- ERROR Messages ----------
2400 BEEP
2410 IF CL$="Y" THEN COLOR 4+16,0,0
2420 PRINT " ERROR: Number RANGE must be 1 to 9,999,999"
2430 IF CL$="Y" THEN COLOR 15,1,9
2440 BEEP
2450 RETURN
2460 '
2470 '
2480 ' ------ scaling ---------
2490 Z! = Z! / 100!
2500 IF Z! > 1! THEN 2490
2510 RETURN
2520 '
2530 '
2540 '
2550 CLS
2560 PRINT WZ$
2570 PRINT " ": PRINT " ": PRINT " "
2580 PRINT "Possible Output files:"
2590 PRINT " 'A:FILE.EXT' 'B:FILE.EXT' 'LPT1:' 'CON:' 'CAS1:'"
2600 PRINT " for FILES the input and Output must be different"
2610 PRINT " "
2620 INPUT "Enter Output file name (Full name): "; U$
2630 IF U$ = "con:" THEN U$="CON:"
2640 IF U$ <> "CON:" THEN OPEN "O",2,U$
2650 PRINT " ": PRINT " "
2660 PRINT "Possible Input files:"
2670 PRINT " 'A:FILE.EXT' 'B:FILE.EXT' 'C:FILE.EXT' 'CON:' 'CAS1:'"
2680 PRINT " "
2690 INPUT "Enter Input FILE (full name): "; F1$
2700 IF F1$= "con:" THEN F1$="CON:"
2710 IF F1$ <> "CON:" THEN OPEN "I",1,F1$
2720 PRINT " "
2730 PRINT " "
2740 INPUT "Encode or Decode (E or D) ";EN$
2750 EN$=LEFT$(EN$,1)
2760 IF EN$ = "e" THEN EN$="E"
2770 IF EN$ = "d" THEN EN$="D"
2780 IF EN$ <> "D" AND EN$ <> "E" THEN 2740
2790 IF EN$="E" AND U$ <> "CON:" THEN PRINT #2, HDR$
2800 IF EN$ <> "D" THEN 2870
2810 IF F1$="CON:" THEN 2870
2820 LINE INPUT #1, HDR$
2830 IF LEFT$(HDR$,14) = WH$ THEN 2870
2840 PRINT "* * * File was never Encoded by "; WH$
2850 PRINT " file header = "; HDR$
2860 END
2870 CLS: PRINT WZ$: PRINT " ": PRINT " "
2880 IF CL$="Y" THEN COLOR 4+16,0,0
2890 IF CL$="N" THEN COLOR 7+16,0
2900 PRINT " * * * R U N N I N G * * *"
2910 IF CL$="Y" THEN COLOR 15,9,1
2920 IF CL$="N" THEN COLOR 7,0
2930 PRINT " "
2940 IF F1$="CON:" THEN PRINT "--> Terminate Console Input with use '//END'"
2950 IF EN$="D" AND F1$ <> "CON:" THEN PRINT "File Header: "; HDR$
2960 PRINT " "
2970 IF F1$ = "CON:" THEN 3010
2980 IF EOF(1) <> 0 THEN 3590
2990 LINE INPUT #1, M$
3000 GOTO 3030
3010 LINE INPUT M$
3020 IF M$ = "//END" OR M$ = "//end" THEN 3590
3030 L%=LEN(M$)
3040 IF L% = 0 THEN 3390
3050 FOR JJ%=1 TO L%
3060 IX%(JJ%)=JJ%
3070 NEXT JJ%
3080 L9%=INT(L%/2)
3090 GOSUB 5990
3100 IF EN$="D" THEN GOSUB 6270
3110 FOR J%=1 TO L%
3120 H%=ASC( MID$(M$,J%,1))
3130 H% = H% - 32
3140 S#=A#
3150 L=M%
3160 GOSUB 3450
3170 A#=S#
3180 ACNT! = ACNT! + 1
3190 B%=O%
3200 L=N%
3210 S#=B#(B%)
3220 BCNT%(B%) = BCNT%(B%) + 1
3230 GOSUB 3450
3240 B#(B%)=S#
3250 B%=O%
3260 S#=C#(B%)
3270 CCNT%(B%) = CCNT%(B%) + 1
3280 L=L0%
3290 GOSUB 3450
3300 C#(B%)=S#
3310 IF EN$="E" THEN H% = H% + O%
3320 IF EN$="D" THEN H% = K0% + (H% - O%)
3330 H% = H% MOD L0%
3340 H% = H% + 32
3350 CHNO%(H%) = CHNO%(H%) + 1
3360 MID$(M$,J%,1)=CHR$(H%)
3370 NEXT J%
3380 IF EN$="E" THEN GOSUB 6270
3390 IF U$ <> "CON:" THEN PRINT #2, M$
3400 IF U$ = "CON:" THEN PRINT M$ : PRINT " "
3410 GOTO 2970
3420 '
3430 '
3440 ' -------- RANDOM NUMBER GENERATOR (1) ------
3450 S#=S# * MU#
3460 S#=S# - (MD# * INT(S# / MD#) )
3470 O%=1 + FIX(L * (S# / MD#) )
3480 RETURN
3490 '
3500 '
3510 ' -------- RANDOM NUMBER GENERATOR (2) ------
3520 S!=(S! + 1.352968) ^ 1.256973
3530 S!=S! - FIX(S!)
3540 O%=1 + FIX(L * S!)
3550 RETURN
3560 '
3570 '
3580 '
3590 PRINT " "
3600 IF U$ <> "CON:" THEN CLOSE 2
3610 IF F1$ <> "CON:" THEN CLOSE 1
3620 IF U$="CON:" THEN D! = 5 : GOSUB 7230 ' TIME DELAY $
3630 '
3640 '
3650 ' ------- CLEAR MEMORY & STOP --------
3660 INPUT "Wish to Save newly Computed KEYS to a FILE (Y or N) "; F$
3670 F$=LEFT$(F$,1)
3680 IF F$="Y" OR F$ = "y" THEN GOSUB 7040
3690 INPUT "Wish to Save Log Statistics for keys used (Y or N) "; F$
3700 F$=LEFT$(F$,1)
3710 IF F$="Y" OR F$ = "y" THEN GOSUB 7690
3720 Z!=0: A#=0: M$=SPACE$(128): S! = 0 : S# = 0
3730 FOR J%=1 TO M%
3740 B#(J%)=0 : BCNT%(J%)=0
3750 NEXT J%
3760 FOR J%=1 TO N%
3770 C#(J%)=0 : CCNT%(J%)=0
3780 NEXT J%
3790 FOR J%=1 TO 256
3800 IX%(J%)=0
3810 NEXT J%
3820 COLOR 7,0
3830 CLS
3840 END
3850 '
3860 ' ----------- ALPHANUMERIC KEYS -----------
3870 '
3880 CLS
3890 PRINT WZ$
3900 PRINT " "
3910 PRINT " "
3920 PRINT " There are two(2) levels of Security HIGH and LOW"
3930 INPUT " Enter H for HIGH or L for LOW "; A$
3940 A$=LEFT$(A$,1)
3950 IF A$ <> "H" AND A$ <> "h" AND A$ <> "L" AND A$ <> "l" THEN 3910
3960 IF A$ = "H" OR A$ = "h" THEN 5190
3970 '
3980 ' ----------- LOW level of SECURITY -------------
3990 '
4000 PRINT " LOW Level of Security Selected"
4010 PRINT " "
4020 PRINT " You must now enter SEVEN (7) key Alphanumerics as indicated:"
4030 PRINT " "
4040 GOSUB 4090
4050 GOTO 2550
4060 '
4070 '
4080 ' ---------- KEY 1 ---------
4090 X%=1 : M% = 11 : N% = 47
4100 IF T$ = "A" THEN GOSUB 5340
4110 IF T$ = "N" THEN GOSUB 2300
4120 GOSUB 3520
4130 GOSUB 3520
4140 A#=FIX((1# - S!) * MD#)
4150 '
4160 '
4170 ' ---------- KEY 2 ----------
4180 X%=2
4190 IF T$ = "A" THEN GOSUB 5340
4200 IF T$ = "N" THEN GOSUB 2300
4210 GOSUB 3520
4220 L=4
4230 FOR J%=1 TO M%
4240 GOSUB 3520
4250 O2% = O%
4260 FOR K%=1 TO O2%
4270 GOSUB 3520
4280 NEXT K%
4290 GOSUB 3520
4300 B#(J%)=FIX((1# - S!) * MD#)
4310 NEXT J%
4320 '
4330 '
4340 ' ---------- KEY 3 -----------
4350 X%=3
4360 IF T$ = "A" THEN GOSUB 5340
4370 IF T$ = "N" THEN GOSUB 2300
4380 GOSUB 3520
4390 L=3
4400 FOR J%=1 TO N%
4410 GOSUB 3520
4420 O2% = O%
4430 FOR K%=1 TO O2%
4440 GOSUB 3520
4450 NEXT K%
4460 GOSUB 3520
4470 C#(J%)=FIX((1# - S!) * MD#)
4480 NEXT J%
4490 '
4500 '
4510 ' ---------- KEY 4 -------------
4520 X%=4
4530 IF T$ = "A" THEN GOSUB 5340
4540 IF T$ = "N" THEN GOSUB 2300
4550 GOSUB 3520
4560 L=INT(N%/2)
4570 GOSUB 3520
4580 K%=O% + 1
4590 L=N%
4600 FOR J%=1 TO K%
4610 GOSUB 3520
4620 L%=O%
4630 GOSUB 3520
4640 C#(L%)=FIX(S! * MD#)
4650 NEXT J%
4660 '
4670 '
4680 ' ----------- KEY 5 ---------------
4690 X%=5
4700 IF T$ = "A" THEN GOSUB 5340
4710 IF T$ = "N" THEN GOSUB 2300
4720 GOSUB 3520
4730 L=INT(M%/2)
4740 GOSUB 3520
4750 K%=O% + 1
4760 L=M%
4770 FOR J%=1 TO K%
4780 GOSUB 3520
4790 L%=O%
4800 GOSUB 3520
4810 B#(L%)=FIX(S! * MD#)
4820 NEXT J%
4830 '
4840 '
4850 ' ------------ KEY 6 ---------------
4860 X%=6
4870 IF T$ = "A" THEN GOSUB 5340
4880 IF T$ = "N" THEN GOSUB 2300
4890 GOSUB 3520
4900 L=M%
4910 FOR J%=1 TO M%
4920 GOSUB 3520
4930 D#=B#(O%)
4940 B#(O%)=B#(J%)
4950 B#(J%)=D#
4960 NEXT J%
4970 '
4980 '
4990 ' ------------- KEY 7 --------------
5000 X%=7
5010 IF T$ = "A" THEN GOSUB 5340
5020 IF T$ = "N" THEN GOSUB 2300
5030 GOSUB 3520
5040 L=N%
5050 FOR J%=1 TO N%
5060 GOSUB 3520
5070 D#=C#(O%)
5080 C#(O%)=C#(J%)
5090 C#(J%)=D#
5100 NEXT J%
5110 '
5120 GOSUB 7440 ' Display generated keys
5130 '
5140 RETURN
5150 '
5160 ' ---------- end of LOW security ------------
5170 '
5180 '
5190 CLS
5200 PRINT " You must enter 3 long PASSWORDS of alphanumeric data"
5210 X%=1
5220 GOSUB 5530
5230 X%=M%
5240 GOSUB 5530
5250 X%=N%
5260 GOSUB 5530
5270 '
5280 GOSUB 7440 ' Display generated keys
5290 '
5300 GOTO 2550
5310 '
5320 '
5330 ' --------- alphanumeric password to RND ------------
5340 PRINT "[";X%;"] Enter Password: ";
5350 LINE INPUT P$
5360 L%=LEN(P$)
5370 IF L% < 6 THEN PRINT " *** password too short; not > 5": GOTO 5340
5380 IF X%=1 THEN K# = 0
5390 FOR J%=1 TO L%
5400 C%=ASC( MID$(P$,J%,1) )
5410 LL%=J%
5420 IF LL% > 7 THEN LL% = LL% MOD 7 : LL%=LL%+1
5430 K# = K# + (CONS!(LL%) * C%)
5440 NEXT J%
5450 Z! = K#
5460 GOSUB 2480
5470 K# = K# - (YY# * INT( K# / YY#))
5480 S! = Z!
5490 RETURN
5500 '
5510 '
5520 ' ------- alphanumeric to DECIMAL --------
5530 X2%=X% * 6
5540 X3% = X2% : X4% = 0
5550 IF X%=1 THEN PRINT " (A) Enter Password of at least (MIN) ";X2%;" Chars"
5560 IF X%=M% THEN PRINT " (B) Enter Password of at least (MIN) ";X2%;" Chars"
5570 IF X2% > 60 THEN X3% = 60: X4% = X2% - 60: CLS: PRINT WZ$: PRINT " "
5580 IF X%=N% THEN PRINT " (C) Enter Password of at least (MIN) ";X2%;" Chars"
5590 PRINT " ": PRINT " "
5600 PRINT " "; LEFT$(W2$,X3%)
5610 PRINT " "; LEFT$(W1$,X3%)
5620 PRINT " "; LEFT$(W3$,X3%)
5630 PRINT "Password:";
5640 LINE INPUT P$
5650 PRINT " "
5660 IF X4% = 0 THEN 5740
5670 PRINT " ": PRINT " "
5680 PRINT " "; LEFT$(W4$,X4%)
5690 PRINT " "; LEFT$(W1$,X4%)
5700 PRINT " "; LEFT$(W3$,X4%)
5710 PRINT "Password:";
5720 LINE INPUT P2$
5730 P$ = P$ + P2$
5740 L%=LEN(P$)
5750 IF L% < X2% THEN PRINT " *** Password TOO SHORT reenter ": GOTO 5530
5760 T%=INT(L%/X%)
5770 K#=0
5780 FOR K%=1 TO X%
5790 P2$=LEFT$(P$,T%)
5800 L%=L%-T%
5810 IF L% < 1 THEN 5830
5820 P$=RIGHT$(P$,L%)
5830 FOR J%=1 TO T%
5840 LL%=J%
5850 IF LL% > 6 THEN LL%= LL% MOD 6 : LL%=LL%+1
5860 C% = ASC( MID$(P2$,J%,1) )
5870 K# = K# + (CONS#(LL%) * C%)
5880 NEXT J%
5890 IF X%=1 THEN A#=K#
5900 IF X%=M% THEN B#(K%) = K#
5910 IF X%=N% THEN C#(K%) = K#
5920 K# = K# - (MD# * INT( K# / MD# ))
5930 NEXT K%
5940 RETURN
5950 '
5960 '
5970 ' ------ TRANSPOSITION -------
5980 '
5990 FOR JJ%=1 TO L%
6000 L=M%
6010 S#=A#
6020 GOSUB 3450
6030 A#=S#
6040 B%=O%
6050 L=N%
6060 S#=B#(B%)
6070 GOSUB 3450
6080 B#(B%)=S#
6090 B%=O%
6100 S#=C#(B%)
6110 L=L%
6120 GOSUB 3450
6130 C#(B%)=S#
6140 SWAP IX%(JJ%),IX%(O%)
6150 NEXT JJ%
6160 IF DEBUG$ = "N" THEN 6230
6170 FOR JJ%=1 TO L% : B% = IX%(JJ%)
6180 IF SAV%(JJ%) = B% THEN SAME1! = SAME1! + 1
6190 SAV%(JJ%) = B%
6200 IF B% = JJ% THEN SAME2! = SAME2! + 1
6210 NEXT JJ%
6220 TOT! = TOT! + L%
6230 RETURN
6240 '
6250 '
6260 '
6270 FOR JJ%=1 TO L9%
6280 G1%=IX%(JJ%)
6290 G2%=IX%(JJ%+L9%)
6300 G1$=MID$(M$,G1%,1)
6310 G2$=MID$(M$,G2%,1)
6320 SWAP G1$,G2$
6330 MID$(M$,G1%,1)=G1$
6340 MID$(M$,G2%,1)=G2$
6350 NEXT JJ%
6360 RETURN
6370 '
6380 '
6390 '
6400 ' ------ Help / Instructions -----
6410 OPEN "I",3,"PC-CODE2.DOC"
6420 CLS
6430 JJ%=1
6440 PRINT WZ$: PRINT " ": PRINT " "
6450 IF EOF(3) <> 0 THEN 6540
6460 LINE INPUT #3, M$
6470 PRINT M$
6480 JJ%=JJ%+1
6490 IF JJ% < 19 THEN 6450
6500 PRINT "======================="
6510 INPUT "Wish More Documentation (Yes or No) <CR>=yes "; Z$
6520 Z$=LEFT$(Z$,1)
6530 IF Z$ <> "N" AND Z$ <> "n" THEN 6420
6540 CLOSE 3
6550 RETURN
6560 '
6570 '
6580 '
6590 CLS
6600 PRINT WZ$: PRINT " ": PRINT " ":PRINT " "
6610 INPUT "Do you have COLOR installed on your PC (Yes or No) ";Z$
6620 Z$=LEFT$(Z$,1)
6630 IF Z$="y" THEN Z$="Y"
6640 IF Z$="n" THEN Z$="N"
6650 IF Z$ <> "Y" AND Z$ <> "N" THEN 6610
6660 CL$=Z$
6670 IF CL$="N" THEN 6700
6680 SCREEN 0,1
6690 COLOR 15,9,1
6700 PRINT " ": PRINT " "
6710 INPUT "Do you wish some instructions/Help (Yes or No) ";Z$
6720 Z$=LEFT$(Z$,1)
6730 IF Z$="y" THEN Z$="Y"
6740 IF Z$="n" THEN Z$="N"
6750 IF Z$ <> "Y" AND Z$ <> "N" THEN 6710
6760 IF Z$="Y" THEN GOSUB 6400
6770 RETURN
6780 '
6790 '
6800 '
6810 INPUT "Enter the Fully Qualified Input Key FILE name: "; F$
6820 OPEN "I", 5, F$
6830 LINE INPUT #5, P$
6840 IF LEFT$(P$,1) <> "*" THEN A#=VAL(P$): GOTO 6880
6850 INPUT #5, T%, M%, N%
6860 IF T% <> 1 THEN PRINT "*** ERROR *** Reading Bad Key File": END
6870 INPUT #5, A#
6880 A# = ABS( FIX( A# ) )
6890 IF EOF(5) <> 0 THEN PRINT "*** ERROR *** Reading Key File": END
6900 FOR J%=1 TO M% : INPUT #5, B#(J%)
6910 B#(J%) = ABS( FIX( B#(J%) ) ) : NEXT J%
6920 IF EOF(5) <> 0 THEN PRINT "*** ERROR *** Reading Key File": END
6930 FOR J%=1 TO N% : INPUT #5, C#(J%)
6940 C#(J%) = ABS( FIX( C#(J%) ) ) : NEXT J%
6950 IF EOF(5) <> 0 THEN PRINT "*** ERROR *** Reading Key File": END
6960 T% = M% + N% + 1
6970 PRINT "*** Loaded "; T% ;" Keys from "; F$; " Successfully"
6980 PRINT " ": D! = 4 : GOSUB 7230 ' TIME DELAY
6990 CLOSE 5
7000 RETURN
7010 '
7020 '
7030 '
7040 INPUT "Enter the Fully Qualified Output Key File Name: "; F$
7050 OPEN "O", 5, F$
7060 PRINT #5, "* HDR PC-CODE2 saved KEYS "
7070 WRITE #5, 1, M%, N%
7080 PRINT #5, A#
7090 FOR J%=1 TO M% : PRINT #5, B#(J%)
7100 NEXT J%
7110 FOR J%=1 TO N% : PRINT #5, C#(J%)
7120 NEXT J%
7130 PRINT #5, "* Keys computed on " + DATE$ + " " + TIME$ + " " + WH$
7140 T% = M% + N% + 1
7150 PRINT "*** Saved "; T% ;" Keys to "; F$; " Successfully"
7160 PRINT " ": D! = 4 : GOSUB 7230 ' TIME DELAY
7170 CLOSE 5
7180 RETURN
7190 '
7200 '
7210 '
7220 ' ------- Delay function -------
7230 GOSUB 7330
7240 D1! = TI!
7250 GOSUB 7330 ' Loop Here
7260 D2! = ABS( TI! - D1! )
7270 IF D2! < D! THEN 7250
7280 RETURN
7290 '
7300 '
7310 '
7320 ' ------- TIMER function --------
7330 TI! = VAL(LEFT$(TIME$,2)) * 3600
7340 TI! = TI! + (VAL( MID$(TIME$,4,2)) * 60)
7350 TI! = TI! + VAL(RIGHT$(TIME$,2))
7360 RETURN ' TI! now contains seconds like TIMER
7370 '
7380 '
7390 '
7400 '
7410 '
7420 '
7430 ' ----- Generated Key Seeds display ------
7440 CLS: PRINT WZ$ : PRINT " ": PRINT " "
7450 PRINT "The following Numeric Keys/Seeds were generated:"
7460 PRINT " " : PRINT " "
7470 P$=SPACE$(16)
7480 PRINT " ( A ) : "; A#
7490 PRINT " "
7500 PRINT " ( B ) : ";
7510 FOR J%=1 TO M%
7520 PRINT LEFT$(STR$(B#(J%))+P$,16);
7530 NEXT J%
7540 PRINT " " : PRINT " "
7550 PRINT " ( C ) : ";
7560 FOR J%=1 TO N%
7570 PRINT LEFT$(STR$(C#(J%))+P$,16);
7580 NEXT J%
7590 PRINT " ": PRINT " "
7600 PRINT " --- To Print this screen depress 'Shift PrtSc' ---"
7610 D! = 20 : GOSUB 7230
7620 RETURN
7630 '
7640 '
7650 '
7660 '
7670 '
7680 ' ---- Save Log Statistics for Keys used -----
7690 PRINT "Enter Stat Log File Name or 'LPT1:' or default of blank"
7695 F$ = " "
7700 INPUT "Enter Log File Name: "; F$
7710 IF LEN(F$)=0 OR LEFT$(F$,1)=" " THEN F$="PC-STAT2.LOG"
7720 OPEN "O", 6, F$
7730 PRINT #6, " "
7740 PRINT #6, " <<<<< PC-CODE2 Statistics for Keys Used >>>>>"
7750 PRINT #6, " " : PRINT #6, " "
7755 PRINT #6, " Date and Time Stamp = "; DATE$ + " " + TIME$
7760 PRINT #6, " Keys Setup (B) size = "; M%
7770 PRINT #6, " Keys Setup (C) size = "; N%
7780 PRINT #6, " Total Characters processed = "; ACNT!
7790 PRINT #6, " "
7800 PRINT #6, " ----- Key Utilitization/Balance -----"
7810 PRINT #6, " " : PRINT #6, " "
7820 PRINT #6, " * For Key Group (B)"
7830 PRINT #6, " "
7840 PRINT #6, " KEY Count"
7850 FOR J%=1 TO M%
7860 PRINT #6, USING " ### ####### "; J%, BCNT%(J%)
7870 NEXT J%
7880 PRINT #6, " " : PRINT #6, " "
7890 PRINT #6, " * For Key Group (C)"
7900 PRINT #6, " "
7910 PRINT #6, " KEY Count"
7920 FOR J%=1 TO N%
7930 PRINT #6, USING " ### ####### "; J%, CCNT%(J%)
7940 NEXT J%
7950 PRINT #6, " " : PRINT #6, " "
7960 PRINT #6, " * Output Character Set Statistics:"
7970 PRINT #6, " "
7980 PRINT #6, " CHR$ Char Count"
7990 PRINT #6, " Num ---- Occur"
8000 FOR J%=0 TO 255
8010 IF CHNO%(J%)=0 THEN 8040
8020 IF J% > 31 AND J% < 127 THEN P$=CHR$(J%) ELSE P$=" "
8030 PRINT #6, USING " #### ! ####### "; J%, P$, CHNO%(J%)
8040 NEXT J%
8050 PRINT #6, " "
8060 IF DEBUG$ = "N" THEN 8130
8070 PRINT #6, " ": PRINT #6, " * Debuging Statistics": PRINT #6, " "
8080 PRINT #6, " "
8090 PRINT #6, " Transposition count: "; TOT!, " 100%"
8100 PRINT #6, " coincidences T1 "; SAME1!, 100 * (SAME1!/TOT!);"%"
8110 PRINT #6, " coincidences T2 "; SAME2!, 100 * (SAME2!/TOT!);"%"
8120 PRINT #6, " ": PRINT #6, " "
8130 PRINT #6, " *** END of STATISTICAL LOG ***"
8140 PRINT " *** Saved Stat Log file to "; F$; " ***"
8150 CLOSE 6
8160 RETURN
8170 '
8180 '
8190 END
J%=1 TO N%
7930 PRINT #6, USING " ### ####### "; J%, CCNT%(J%)
7940 NEXT J%
7950 PRINT #6, " " : PRINT #6